package com.fan.configService.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fan.configService.mapper.ResourceEnvMapper;
import com.fan.configService.po.ResourceEnv;
import com.fan.configService.util.ConvertUtil;
import com.fan.configService.vo.ResourceEnvVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * java类简单作用描述
 *
 * @Description: java类作用描述
 * @Author: hf
 * @CreateDate: 2018/9/4 15:53
 * @UpdateUser: hf
 * @UpdateDate: 2018/9/4 15:53
 * @UpdateRemark: The modified content
 * @Version: 1.0
 */
@Service
public class ResourceEnvService {
    @Autowired
    ResourceEnvMapper resourceEnvMapper;

    public List<ResourceEnvVo> getAllResourceEnvById(Long resourceId) {
        LambdaQueryWrapper<ResourceEnv> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(ResourceEnv::getResourceId, resourceId);
        List<ResourceEnv> resourceEnvs = resourceEnvMapper.selectList(lambdaQueryWrapper);
        return ConvertUtil.copyTo(resourceEnvs, ResourceEnvVo.class);
    }
}
